using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace FCalendar
{
    public partial class About : Form
    {
        Form raadForm = new Form();

        public About()
        {
            InitializeComponent();

            // Initialize RADOBARGH
            raadForm.WindowState = FormWindowState.Maximized;
            raadForm.FormBorderStyle = FormBorderStyle.None;
            raadForm.Width = DesktopBounds.Width;
            raadForm.Height = DesktopBounds.Height;
            raadForm.Top = 0;
            raadForm.Left = 0;
            raadForm.TopMost = true;
            raadForm.BackColor = Color.White;
            raadForm.ShowInTaskbar = false;

        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("mailto:amir.karimi@gmail.com");
        }

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://www.amirkarimi.net");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("mailto:info@amirkarimi.com");
        }

        private int RotateColor = 0; // 0 to 256*6 = 1536

        /*
        private int Red = 255, RedAcc = 0;
        private int Green = 0, GreenAcc = 0;
        private int Blue = 0, BlueAcc = 1;
        */

        private void timer1_Tick(object sender, EventArgs e)
        {
            int r = 0, g = 0, b = 0;
            int t = RotateColor % 256;
            switch (RotateColor / 256)
            {
                case 0:
                    r = 255;
                    b = t;
                    break;
                case 1:
                    b = 255;
                    r = 255 - t;
                    break;
                case 2:
                    b = 255;
                    g = t;
                    break;
                case 3:
                    g = 255;
                    b = 255 - t;
                    break;
                case 4:
                    g = 255;
                    r = t;
                    break;
                case 5:
                    r = 255;
                    g = 255 - t;
                    break;
                default:
                    RotateColor = 0;
                    break;
            }
            RotateColor++;

            labelMain.ForeColor = Color.FromArgb((int)(r/1.5),(int)(g/1.5),(int)(b/1.5));

            Random rnd = new Random();
            if (rnd.Next()%100 == 50)
            {

                for (int i = 0; i < rnd.Next() % 3; i++)
                {
                    raadForm.Show();
                    // Show Amir
                    try
                    {
                        Graphics gt = raadForm.CreateGraphics();
                        StringFormat sf = new StringFormat();
                        gt.DrawString("AMIR",
                            new Font(
                                FontFamily.Families[rnd.Next() % FontFamily.Families.Length],
                                (float)150 + rnd.Next() % 100),
                            new SolidBrush(Color.FromArgb(155 + rnd.Next() % 100, 155 + rnd.Next() % 100, 155 + rnd.Next() % 100)),
                            new PointF((float)rnd.Next() % DesktopBounds.Width,
                                (float)rnd.Next() % DesktopBounds.Height));
                    }
                    catch (Exception)
                    {
                    }
                    // Wait for see
                    System.Threading.Thread.Sleep(50 + (rnd.Next() % 100));
                    raadForm.Hide();
                }
            }
        }

        private void About_FormClosed(object sender, FormClosedEventArgs e)
        {
            timer1.Enabled = false;
        }
    }
}